<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/main.css">
</head>

<body>

<table border="1" style="border-collapse: collapse; width: 200px">
    <tr>
        <td>Id</td>
        <td>Name</td>
        <td>Age</td>
        <td>City</td>
        <td>Street</td>
        <td>House</td>
        <td>Action</td>
    </tr>
    <g:each in="${persons}" var="person">
        <tr>
            <td>${person.id}</td>
            <td>${person.name}</td>
            <td>${person.age}</td>
            <td>${person.address.city}</td>
            <td>${person.address.street}</td>
            <td>${person.address.house}</td>
            <td><input type="button" value="Delete" onclick="window.location.href='<g:createLink action="delete" controller="person" id="${person.id}"/>'"></td>
        </tr>
    </g:each>

</table>

<g:paginate total = "${personCount}" max = "10" next = "Next" prev = "Prev" action = "show"/>

<br>
<br>
<br>

<input type="button" value="Create new person" onclick="window.location.href='<g:createLink action="createPerson" controller="person"/>'">

</body>
</html>